-# locals: object, scope_id

-all_object_categorizations = object.categorizations.includes(:category).where(:categories => { :scope_id => scope_id }).all

%li.tab-title-holder
  .item-main
    .item-title
      .row-fluid
        .span12
          .js-list-container-title
            %h3.tab-title
              Categories
              %span{:class => "grc-badge #{all_object_categorizations.count.zero? ? "no-object" : ""}"}
                (#{all_object_categorizations.count})
              %a.pull-right{:href => list_edit_flow_categorizations_path(:object_type => object.class.name, :object_id => object.id, :scope_id => scope_id), :'data-toggle' => 'modal-ajax-relationship-selector', :'data-modal-reset' => 'reset', :'data-list-target' => '#categoryList', :'data-modal-class' => 'modal-wide', :rel => "tooltip", :'data-placement'=> "left", :title => "Link Categories"}
                %i.grcicon-link


  %script#category_list_item{ :type => 'text/html', :'data-member' => 'categorization' }
    %li.controlSlot{ :'data-id' => '<%= category.id %>' }
      .item-main
        .item-title
          .row-fluid
            .span12
              .oneline
                %span.cat-parent
                  <%= category.parent_name %>
                %span.cat-name
                  <%= category.name || '&nbsp;' %>
      
  %ul#categoryList.tree-structure{ :'data-template-id' => 'category_list_item' }
    -all_object_categorizations.each do |object_item|
      -item = object_item.category
      %li{ :'data-id' => item.id }
        .item-main
          .item-title
            .row-fluid
              .span12
                .oneline
                  %span.cat-parent
                    =item.parent_name
                  %span.cat-name
                    =item.name || '&nbsp;'.html_safe
